using UnityEngine;

public class Tutorial : MonoBehaviour
{
	public GUISkin skin;

	public AudioClip clip;

	private int step;

	private Vector2 scale;

	private float originalWidth = 640f;

	private float originalHeight = 360f;

	private void Start()
	{
		if (PlayerPrefs.GetInt("TutorialDone") == 1)
		{
			UnityEngine.Object.Destroy(base.gameObject);
		}
		if (Screen.width > 640)
		{
			scale.x = (float)Screen.width / originalWidth;
			scale.y = (float)Screen.height / originalHeight;
		}
		else
		{
			scale.x = 1f;
			scale.y = 1f;
		}
		if (Screen.width > 1020)
		{
			scale.x = 1024f / originalWidth;
			scale.y = 600f / originalHeight;
		}
	}

	private void OnGUI()
	{
		GUI.skin = skin;
		Rect clientRect = new Rect((float)Screen.width * 0.25f, (float)Screen.height * 0.25f, (float)Screen.width - (float)Screen.width * 0.5f, (float)Screen.height - (float)Screen.height * 0.5f);
		if (step == 0)
		{
			clientRect = GUI.Window(0, clientRect, DoWindow1, "1");
		}
		if (step == 1)
		{
			clientRect = GUI.Window(0, clientRect, DoWindow2, "2");
		}
	}

	private void DoWindow1(int windowID)
	{
		if (GUILayout.Button("OK", GUILayout.Width(180f * scale.x), GUILayout.Height(30f * scale.y)))
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
		}
	}

	private void DoWindow2(int windowID)
	{
		if (GUILayout.Button("OK", GUILayout.Width(180f * scale.x), GUILayout.Height(30f * scale.y)))
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
		}
	}
}
